package com.flyfinger.boot;

import com.flyfinger.client.RPCConsumer;
import com.flyfinger.service.IUserService;

public class ConsumerBoot {

	public static void main(String[] args) throws Exception {
		final RPCConsumer rpcConsumer = new RPCConsumer();

		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				System.out.println("===关闭客户端服务===");
				rpcConsumer.close();
			}
		});

		IUserService service = rpcConsumer.createProxy(IUserService.class);

		while (true) {
			System.out.println("=====开始发送消息=====");
			String result = service.sayHello("are you ok !!");
			System.out.println("接收到服务端发送的消息为：" + result);
			Thread.sleep(3000);
		}

	}
}
